package com.feng.zshop.common.util;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.UUID;

/**
 * @author Lee
 * @date 2019/2/18
 */
public class StringUtil {

    public static String renameFileName(String uploadPath, String fileName){
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyMMddhhmmss");
        // 获取文件后缀
        String suffix = fileName.substring(fileName.lastIndexOf('.'));
        // 生成文件名
        String newFileName = simpleDateFormat.format(new Date()) + "-" + UUID.randomUUID();

        return uploadPath + "\\" + newFileName + suffix;
    }

}
